import { BaseHandinMaterial } from "../BaseHandinMaterial";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { PublicMessageConfig } from "../../../resource/PublicMessageConfig";
import { ItemConfig } from "../../../resource/ItemConfig";
import { RandRewardConfig } from "../../../resource/RandRewardConfig";
import { ERandRewardType } from "../../../../../Message/Public/ERandRewardType";
import { ItemData } from "../../../resource/info/ItemData";
import { ItemInfo } from "../../../resource/info/ItemInfo";
import { ECategory } from "../../../../../Message/Public/ECategory";
import { EProp } from "../../../../../Message/Public/EProp";
import { EBind } from "../../../../../Message/Public/EBind";
import { DataEvent } from "../../../events/DataEvent";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { EventName } from "../../../mvc/EventName";
import { EHandInMaterialType } from "../../../../../Message/Game/EHandInMaterialType";
import { _EHandInMaterialFixStone } from "../../../../../EHandInMaterialType/_EHandInMaterialFixStone";
//class HandinStoneMaterial
    
    export  class HandinStoneMaterial extends BaseHandinMaterial
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this.title = Language.getString(69805);
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc1=null;
            var loc3=null;
            super.createChildren();
            _descText.htmlText = PublicMessageConfig.instance.getTextByTypeAndName("HandinMaterialDesc", "2");
            loc1 = ItemConfig.instance.getItemsByJudge(this.materialJudge);
            this.materials = loc1;
            loc1 = [];
            var loc2=RandRewardConfig.instance.getRewardsByType(ERandRewardType._ERandRewardFixStone);
            var loc4=0;
            var loc5=loc2;
            for(loc3 of loc5) 
            {
                loc1.push(new ItemData(loc3.code));
            }
            createRewards(loc1);
            return;
        }

        /* internal  */materialJudge(arg1: ItemInfo): Boolean
        {
            if (arg1.item.category == ECategory._ECategoryProp && arg1.item.type == EProp._EPropFixStoneMaterial && arg1.item.bind == EBind._EBindYes) 
            {
                return true;
            }
            return false;
        }

        protected /* override */ doHandinMaterial(arg1: DataEvent): void
        {
            var loc1=arg1.data as ItemData;
            Dispatcher.dispatchEvent(new DataEvent(EventName.HandinMaterial, {"item": loc1, "type": _EHandInMaterialFixStone}));
            return;
        }
    }
